
	 <?php
$global=isSupperManagerForSession();
 ?>
	<script type="text/javascript" src="/static/js/echarts.js"></script>
	
<link rel="stylesheet" type="text/css" href="/static/My97DatePicker/skin/WdatePicker.css" />
     <script charset="utf-8" src="/static/My97DatePicker/WdatePicker.js"></script>
     
     <section class="topBanners">
         <div class="icon"></div>
         <div class="topBannersNav">
         <span data-url="/admin/devlist/tj" data-container="rt_content"   class="topBannerItem">资产汇总</span>

         </div>
      </section>
      <section style="margin-top:10px;margin-left:auto;margin-right:auto;">
       <select name="firstType" id="firstType" class="select">
	       <option value="">--资产分类--</option>
	       <?php
	       
	       foreach($FirstDepList as $key=>$val)
	   		{
	   		?>
	        <option value="<?php echo $val['id']; ?>" <?php if($val['id']==$request['firstType']){ echo 'selected';} ?> ><?php echo $val['dname'] ?></option>
		   <?php
	       }
       		?>
          </select>
          
          
        <select name="stat" id="stat" class="select">
	       <option value="">--资产状态--</option>
	 
	        <option value="0" <?php if($request['stat']=='0'){ echo 'selected';} ?> >正常</option>
	        <option value="1" <?php if($request['stat']=='1'){ echo 'selected';} ?> >库存</option>
	        <option value="2" <?php if($request['stat']=='2'){ echo 'selected';} ?> >外借</option>
	        <option value="3" <?php if($request['stat']=='3'){ echo 'selected';} ?> >报废</option>
	        <option value="4" <?php if($request['stat']=='4'){ echo 'selected';} ?> >报修</option>
		  
          </select>
          
          
     
      <input type="button" value="搜索" class="group_btn research" id="resource" page="1" />
    
      <br style="clear:both;width:0px;height:0px;">
     </section>



  
<div class="tj" id="tongji1" style="float:left;width:48%;height:500px;margin-left:auto;margin-right:auto;margin-top:10px;">
</div>
<div class="tj" id="tongji2" style="float:left;width:48%;height:500px;margin-left:auto;margin-right:auto;margin-top:10px;">
</div>


<?php
	    if( ( in_array(60000,$ruleLists) || $global==1) )
		{
    	?>
<table class="table" style="margin-top:10px;width:80%;margin-bottom:40px;margin-left:auto;margin-right:auto;">

<tr>
<th><input id="all" type="checkbox"></th>
<th>分类ID</th>
<th>分类名称</th>
<th>资产总数量</th>
<th>资产总价格</th>
</tr>
<?php
  foreach($catgoryListTmps as $key=>$val)
	{

   ?>
   <tr data-id="<?php echo $val['id']; ?>">

    <td style="text-align:center;">
    <input type="checkbox" value="<?=$val['id']?>" class="checkBoxInput" name="checked[]" /></td>
   	<td><?php echo $val['id'];?></td>
	<td><?php echo $val['dname'];?></td>
	<td><?php echo $val['num'];?></td>
	<td><?php echo $val['totle'];?></td>
   </tr>
   <?php
	}
?>
</table>
 <?php
 }
?>
<script>
function showBarRight1(catgory,numArr,priceArr) {
    
    
    option = {
    	    title: {
    	        text: '资产统计',

    
    	        
    	    },
    	    tooltip: {
    	        trigger: 'axis',
    	        axisPointer: {
    	            type: 'shadow'
    	        }
    	    },
    	    legend: {
    	        data: ['资产价值']
    	    },
    	    grid: {
    	        left: '3%',
    	        right: '4%',
    	        bottom: '3%',
    	        containLabel: true
    	    },
    	    xAxis: {
    	        type: 'value',
    	        boundaryGap: [0, 1]
    	    },
    	    yAxis: {
    	        type: 'category',
    	        data: catgory
    	    },
    	    series: [
    	       
    	        {
    	            name: '资产价值',
    	            type: 'bar',
    	            data: priceArr
    	        }
    	    ]
    	};
   
        var myChart = echarts.init(document.getElementById('tongji1'));
        myChart.setOption(option);
    

}
function showBarRight2(catgory,numArr,priceArr) {
    
   
    
    
    option = {
    	    xAxis: {
    	        type: 'category',
    	        data: catgory
    	    },
    	    yAxis: {
    	        type: 'value'
    	    },
    	    series: [{
    	        data: numArr,
    	        type: 'line'
    	    }]
    	};

        var myChart = echarts.init(document.getElementById('tongji2'));
        myChart.setOption(option);
    

}
var category=<?php echo  json_encode($category); ?>;
var numArr=<?php echo  json_encode($numArr); ?>;
var priceArr=<?php echo  json_encode($priceArr); ?>;
showBarRight1(category,numArr,priceArr);
showBarRight2(category,numArr,priceArr);
</script>


 <script type="text/javascript">
      
      function myResearch(){
		   var url="/admin/devlist/tj";
		  
		   var firstType =$("#firstType").val();
		  
		   var stat =$("#stat").val();
		  
		   var page=$("#cpage").val();
		   var param={
				  
				   firstType:firstType,
				 
				   stat:stat, 
				  
				   page:page
		   };
		   ContentGet(url,param);
	   }
     
      
           $(function(){
        	   //设置搜索栏
        	   $(".research").click(function(){
        		   var page =$(this).attr("page");
        		   $("#cpage").val(page);
        		   myResearch();
        		   
        	   });
        	   
        	   //删除项
        	   $('.del').click(function(){
        		   var that =this;
        		   var url="/admin/devlist/delData";
        		   var id=$(that).parent().parent().attr('data-id');
        		   var param={
        				   id:id
        		   };
        		   cofirmsss_tishi(1,'您确定要删除吗?',function(id){
        			 
        			   AjaxRequest(url,param,function(data){
            			   if(data.err==0)
            			   {
            				   SuccessTiShi("操作成功");
            				   
            				   $(that).parent().parent().remove();
            				   myResearch();
            			   }
            			   else
            			   {
            				   ErrTiShi("操作失败");
            			   }
            		   });
        			   
        		   });
        	   });
        	   
        	   
        	   //导航
         	   $(".topBannerItem").click(function(){
         		   
         		   var attArr = $(this).attr();
             	   goToSelfLink(attArr);
             	   
         			
         	   });
        	 //启用
        	   $('.qy').click(function(){
        		   var that =this;
        		   var url="/admin/devlist/qyData";
        		   var id=$(that).parent().parent().attr('data-id');
        		   var param={
        				   id:id
        		   };
        		   cofirmsss_tishi(1,'您确定要启用吗?',function(id){
        			 
        			   AjaxRequest(url,param,function(data){
            			   if(data.err==0)
            			   {
            				   SuccessTiShi("操作成功");
            				   $(that).val("禁用");
            				  
            				 
            				  $(that).parent().parent().find(".dataStat").html("正常");
            				   $(that).removeClass("qy");
            				   $(that).addClass("jy");
            				   myResearch();
            			   }
            			   else
            			   {
            				   ErrTiShi("操作失败");
            			   }
            		   });
        			   
        		   });
        	   });
        	 
        	   //禁用
        	   $('.jy').click(function(){
        		   var that =this;
        		   var url="/admin/devlist/jyData";
        		   var id=$(that).parent().parent().attr('data-id');
        		   var param={
        				   id:id
        		   };
        		   cofirmsss_tishi(1,'您确定要禁用吗?',function(id){
        			 
        			   AjaxRequest(url,param,function(data){
            			   if(data.err==0)
            			   {
            				   SuccessTiShi("操作成功");
            				   $(that).val("启用");
            				   
            				   $(that).parent().parent().find(".dataStat").html("禁用");
            				   $(that).removeClass("jy");
            				   $(that).addClass("qy");
            				   myResearch();
            			   }
            			   else
            			   {
            				   ErrTiShi("操作失败");
            			   }
            		   });
        			   
        		   });
        	   });
        	   //编辑项
        	   $(".edit").click(function(){
        		   var that =this;
        		   var url="/admin/devlist/editData";
        		   var id=$(that).parent().parent().attr('data-id');
        		   var param={
        				   id:id
        		   };
        		   MyContentLoad(url,param);
        				 
        				
        			 //弹出：确认按钮
        			
        	   });

        	   $(".resetPwd").click(function(){
        		   var that =this;
        		   var url="/admin/devlist/resetPwd";
        		   var id=$(that).parent().parent().attr('data-id');
        		   var param={
        				   id:id
        		   };
        		   MyContentLoad(url,param);
        				 
        				
        			 //弹出：确认按钮
        			
        	   });
        	   
        	   
        	   
        	   //编辑项
        	   $(".add").click(function(){
        		   
        		   var that =this;
        		   var url="/admin/devlist/addData";
        		   var param={};
        		   MyContentLoad(url,param);
        			 //弹出：确认按钮
        			
        	   });
        	   
  			   //全选
  		
  				$("#all").click(function(){   
			    	if(this.checked){   
			        	$(".checkBoxInput").attr("checked", true);  
			        	$(".checkBoxInput").prop("checked", true);  
			    	}else{   
						$(".checkBoxInput").attr("checked", false);
						$(".checkBoxInput").prop("checked", false);
			    	}   
			    	var se=getAllSelectItem();
			    	//console.log(se);
			 	}); 
  			   
  			   
  				 $(".firstTypeR").change(function(){
    				   
    				   var url="/admin/devlist/selectTypeChange";
    		   		    var id=$(this).val();
    		   		   
    		   		    var param={
    		   				   id:id
    		   				   
    		   		    };
    				   AjaxRequest(url,param,function(data){
    		  			   if(data.err==0)
    		  			   {
    		  				   var html='<option value="">--选择--</option>';
    		  				   $.each(data.data,function(i,v){
    		  					 html +='<option value="'+v.id+'">'+v.dname+'</option>'
    		  				   })
    		  				   $(".secondTypeR").html(html);
    		  			   }
    		  			   else
    		  			   {
    		  				   ErrTiShi("操作失败");
    		  			   }
    		  		   	});
    				   
    			   });
  			
           });
           
	  </script>
   
